<?php
	namespace Home\Controller;
	use Think\Controller;
	
	class UserperconalController extends Controller{
		public function perconal(){
			if(!session("user_id")){
				$this->error("浣犺繕娌℃湁鐧婚檰璇风櫥闄�",U("Users/Userlogin"));
			}else{
                                $uid=I('get.uid')?I('get.uid'):'';
				$touxiang=M('touxiang')->select();
				$this->assign('touxiang',$touxiang);
				$where['uid']=$uid;
				$persoal=M('personal')->where($where)->find();
				$this->assign('tx',$persoal);
				$user_qx=M('jurisdiction_type')->select();
				$jurList=D('jurisdiction')->hasjur(session('user_id'));
				$this->assign('qx',$user_qx);
				$this->assign('jurList',$jurList);
			}
				$this->display("Users/personal");
		}
		//澧炲姞涓汉璧勬枡
		public function addPerconal(){
			$data=array();
			foreach($_POST as $k=>$v){
				if(!empty($v)){
					$data[$k]=$v;
				}
			}
			$personalModel=D('personal')->handlepersonal($data);
			var_dump($personalModel);die();
			if($personalModel){
				$this->ajaxReturn($personalModel);
			}else{
				$this->ajaxReturn(false);
			}
		}
		//淇敼澶村儚
		public function addtouxiang(){
			$uid=I('post.uid')?I('post.uid'):'';
			$imgsrc=I('post.imgsrc')?I('post.imgsrc'):'';
			if(!$uid){
				$data['status']=6;
				$this->ajaxReturn($data);
			}
			$tx['uid']=$uid;
			$tx['user_tx']=$imgsrc;
			$userInfo=D('personal')->addTx($tx);
			if($userInfo!==false){
				$data['status']=1;
			}else{
				$data['status']=2;
			}
			$this->ajaxReturn($data);
		}
		
		//修改权限
		public function upJurisdiction(){
			$user_id=I("get.user_id")?I("get.user_id"):'';
			$qx_id=I("get.qx_id")?I("get.qx_id"):'';
			if(!$user_id || !$qx_id){
				$this->ajaxReturn(false);
			}
			$data['user_id']=$user_id;
			$data['user_jur']=$qx_id;
			$jurModel=D('jurisdiction')->uppjurisdiction($data);
			if($jurModel!==false){
			    $this->ajaxReturn(1);
			}else{
			    $this->ajaxReturn(false);
			}
		}
	}
?>